/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lmclogistics;

import components.Image;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.UIManager;

/**
 *
 * @author Sonia Tan
 */
public class Main {


    public static Login login;
    public static JWindow frame;
    public static TransparentBG bg = new TransparentBG(frame);

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
       
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception e) {
            e.printStackTrace();
        }

//        LoadingScreen loading = new LoadingScreen(3000);

        frame = new JWindow();
        
//        loading.showSplashAndExit();
        bg.setLayout(new BorderLayout());
        frame.getContentPane().add("Center",bg);
        frame.pack();
        showSplashAndExit();



        




        login = new Login();
    }

    public void loading(){


    }
    public static void showSplash() {

//        Image image;

        frame.setAlwaysOnTop(true);
//        setIconImage(image);
//        setBackground(null);
//        setForeground(null);

        

        int width = 600 ;
        int height = 350;
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (screen.width-width)/2;
        int y = (screen.height-height)/2;
        frame.setBounds(x,y,width,height);

        
        // Build the splash screen
        Image label = new Image("loading.png",650,350);


        bg.add(label, BorderLayout.CENTER);




        // Display it
        frame.setVisible(true);

        // Wait a little while, maybe while loading resources
        try { Thread.sleep(3000); } catch (Exception e) {}

        frame.setVisible(false);

    }

    public static void showSplashAndExit() {

        showSplash();
        frame.dispose();


    }



}
